<page-header *ngIf="!agentId" [autoTitle]="false"></page-header>
<nz-card [nzBordered]="!agentId">
  <section class="search-section">
    <input nz-input placeholder="订单号、渠道、客户微信、收件人姓名" [(ngModel)]="keyword" class="search-item"/>
    <nz-select [(ngModel)]="paymentMethod" [nzPlaceHolder]="'支付方式'" class="search-item" [nzAllowClear]="true">
      <nz-option
        *ngFor="let option of payMentMethod"
        [nzLabel]="option.value"
        [nzValue]="option.key">
      </nz-option>
    </nz-select>
    <nz-select [(ngModel)]="status" [nzPlaceHolder]="'状态'" class="search-item" [nzAllowClear]="true">
      <nz-option
        *ngFor="let option of orderStatusOption"
        [nzLabel]="option.value"
        [nzValue]="option.key">
      </nz-option>
    </nz-select>
    <button nz-button [nzType]="'primary'" nzGhost (click)="search()" class="search-item">
      <i class="anticon anticon-search"></i><span>搜索</span>
    </button>
  </section>
  <nz-table #nzTable [nzData]="page.content"
            [nzPageSize]="page.size"
            [nzTotal]="page.totalElements"
            [nzFrontPagination]="false"
            [(nzPageIndex)]="page.number"
            (nzPageIndexChange)="changePageNo($event)"
            [nzLoading]="isLoading">
    <thead>
    <tr>
      <th nz-th><span>序号</span></th>
      <th nz-th><span>订单号</span></th>
      <th nz-th><span>渠道</span></th>
      <th nz-th><span>付款方式</span></th>
      <th nz-th><span>客户微信</span></th>
      <th nz-th><span>收件人姓名</span></th>
      <th nz-th><span>商品总价(￥)</span></th>
      <th nz-th><span>邮费(￥)</span></th>
      <th nz-th><span>订单总价(￥)</span></th>
      <th nz-th><span>创建时间</span></th>
      <th nz-th><span>状态</span></th>
      <th nz-th><span>操作</span></th>
    </tr>
    </thead>
    <tbody>
    <tr *ngFor="let data of nzTable.data;let i=index">
      <td>
        {{i+1}}
      </td>
      <td>{{data.orderNo}}</td>
      <td>{{data.agent?data.agent.name:"平台收取"}}</td>
      <td>{{data.paymentMethod|dicsNamePipe:payMentMethod}}</td>
      <td>{{data.customers?data.customers.name:"未知"}}</td>
      <td>{{data.postalName}}</td>
      <td>{{data.goodsPrice}}</td>
      <td>{{data.postage}}</td>
      <td>{{data.totalPrice}}</td>
      <td>{{data.saveDate}}</td>
      <td>{{data.status|dicsNamePipe:orderStatusOption}}</td>
      <td>
        <a href="javascript:void (0);" (click)="editEntity(data)">查看详情</a>
        <span *ngIf="data.status == 2">
          <nz-divider nzType="vertical"></nz-divider>
          <a href="javascript:void (0);" (click)="logistics(data)">确认发货</a>
        </span>
      </td>
    </tr>
    </tbody>
  </nz-table>
</nz-card>
